home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
4490
/
4490.xpi
/
components
/
scripts
/
nate.js
< prev
next >
Wrap
Text File
|
2010-01-21
|
3KB
|
90 lines
/***********************************************************
nate
***********************************************************/
var hostString="nate.com";
var supportInboxOnly=true;
var supportShowFolders=true;
function init(){
this.isEmpal=false;
this.dataURL="http://mail.nate.com";
this.mailURL="http://mail.nate.com/";
this.mailDomain="mail.+?.nate.com";
var ar=this.user.split("@");
this.loginData=["https://xo.nate.com/servlets/LoginServlet",
"","PASSWD",
"redirect="+encodeURIComponent(this.mailURL)
+"&ID="+encodeURIComponent(ar[1]=="nate.com"?ar[0]:this.user)+"&domain="+encodeURIComponent(ar[1])];
}
function process(aHttpChannel, aData) {
switch(this.stage){
case ST_LOGIN_RES:
this.getHtml(this.dataURL);
return false;
case (ST_LOGIN_RES+1):
if(aHttpChannel.responseStatus==302){
this.dataURL=aHttpChannel.getResponseHeader("Location");
}
var fnd=aData.match(/<frame src=\"(\S+?)\".+?title=\"hidden\"/);
if(fnd)this.dataURL=(this.dataURL+fnd[1]).replace(/([^:])\/\//,"$1/");
this.stage=ST_DATA;
break;
}
return this.baseProcess(aHttpChannel, aData);
}
function getCount(aData){
return this.mailCount;
}
function getData(aData){
var obj={}
if(!this.isEmpal){
var num=0;
var found=false;
if(this.inboxOnly){
var fnd=aData.match(/mc.unseen={inbox:(\d+)/);
if(fnd){
found=true;
num=parseInt(fnd[1]);
}
}else{
var fnd=aData.match(/mc.unseen={(inbox:.+?)}/);
if(fnd){
found=true;
fnd=fnd[1].match(/:\d+/g);
for(var i=0;i<fnd.length;i++){
num+=parseInt(fnd[i].substring(1));
}
}
}
if(found){
var fnd=aData.match(/mbx.addUserMboxes\(\[(\S+?)\]\);/);
if(fnd){
var ar=[];
var re=/\[.*?,.*?,"(.+?)",.*?(\d+)\]/g;
var o;
while ((o = re.exec(fnd[1])) != null){
var n=parseInt(o[2]);
if(!this.inboxOnly)num+=n;
if(n>0){
ar.push(o[1]);
ar.push(o[2]);
}
}
}
this.mailCount=num;
if(this.showFolders){
if(ar)obj.folders=encodeArray(ar);
}
return obj;
}
}
var fnd=aData.match(/\uc0c8\ud3b8\uc9c0\u0020\ucd1d[\s\S]*?<span[\s\S]*?>(\d+)/);
if(fnd){
this.isEmpal=true;
this.mailCount=parseInt(fnd[1]);
return obj;
}
this.mailCount=-1;
return obj;
}